package cn.edu.scau.cmi.tangqingning.adapter.classAdapter;

import cn.edu.scau.cmi.tangqingning.adapter.hotel.GermanHotel;
import cn.edu.scau.cmi.tangqingning.adapter.plug.DBPlugInterface;
import javafx.event.ActionEvent;
import javafx.fxml.FXML;
import javafx.scene.control.TextArea;

public class ClassAdapterController {

	@FXML
    private TextArea textArea;

	DBPlugInterface db;
	GermanHotel hotel = new GermanHotel();

    @FXML
    void onUsingGBPlugClick(ActionEvent event) {

    	db = new ClassAdapter();
    	hotel.setAdapter(db);
    	this.textArea.setText("use chinese plug with DBAdapter");
    }

    @FXML
    void onChargeClick(ActionEvent event) {
    	if(hotel.dBPlugIn == null) {
    		this.textArea.setText("can't use non-german plug");
    	} else {
    		this.textArea.setText(hotel.charge());
    	}

    }

}

